home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / X11 / dox-9.1 / xshev.sh < prev    next >
Linux/UNIX/POSIX Shell Script  |  1995-06-22  |  3KB  |  137 lines

  1. #! /bin/sh
  2.  
  3. : '@(#)xshev.sh    9.1'
  4.  
  5. : 1994    Arthur David Olson
  6. :
  7. : The X Consortium, and any party obtaining a copy of these files from
  8. : the X Consortium, directly or indirectly, is granted, free of charge, a
  9. : full and unrestricted irrevocable, world-wide, paid up, royalty-free,
  10. : nonexclusive right and license to deal in this software and
  11. : documentation files {the "Software"}, including without limitation the
  12. : rights to use, copy, modify, merge, publish, distribute, sublicense,
  13. : and/or sell copies of the Software, and to permit persons who receive
  14. : copies from any such party to do so.  This license includes without
  15. : limitation a license to do the foregoing actions under any patents of
  16. : the party supplying this software to the X Consortium.
  17.  
  18. echo hi | read 2>&- || exec ksh "$0" ${1+"$@"}
  19.  
  20. O="`basename $0`"
  21.  
  22. flags=
  23. oops=0
  24. sawid=0
  25. window=
  26.  
  27. while :
  28. do
  29.     case $1 in
  30.         --)        shift ; break ;;
  31.         -display)    shift
  32.                 case $# in
  33.                     0)    set x ; break ;;
  34.                     *)    flags="$flags -display $1"
  35.                         shift ;;
  36.                 esac ;;
  37.         -id)        shift
  38.                 sawid=1
  39.                 case $# in
  40.                     0)    oops=1 ; break ;;
  41.                     *)    window="$1" ; shift ;;
  42.                 esac ;;
  43.         *)        break ;;
  44.     esac
  45. done
  46.  
  47. case $# in
  48.     0)    ;;
  49.     *)    oops=1 ;;
  50. esac
  51.  
  52. case $oops in
  53.     1)    O=`basename "$0"`
  54.         echo "$O: usage is $O" \
  55.             "[-display displayname]" \
  56.             "[-id windowid]" \
  57.             "# 7.1" >&2
  58.         exit 1 ;;
  59. esac
  60.  
  61. set -e
  62.  
  63. INNER_WINDOW_WIDTH=50
  64. INNER_WINDOW_HEIGHT=50
  65. INNER_WINDOW_BORDER=4
  66. INNER_WINDOW_X=10
  67. INNER_WINDOW_Y=10
  68. OUTER_WINDOW_MIN_WIDTH=`expr \
  69.     $INNER_WINDOW_WIDTH + \
  70.     2 \* \( $INNER_WINDOW_BORDER + $INNER_WINDOW_X \)`
  71. OUTER_WINDOW_MIN_HEIGHT=`expr \
  72.     $INNER_WINDOW_HEIGHT + \
  73.     2 \* \( $INNER_WINDOW_BORDER + $INNER_WINDOW_Y \)`
  74. OUTER_WINDOW_DEF_WIDTH=`expr $OUTER_WINDOW_MIN_WIDTH + 100`
  75. OUTER_WINDOW_DEF_HEIGHT=`expr $OUTER_WINDOW_MIN_HEIGHT + 100`
  76. OUTER_WINDOW_DEF_X=100
  77. OUTER_WINDOW_DEF_Y=100
  78. OUTER_WINDOW_BORDER=2
  79.  
  80. # Since the cooperating process ends up in a NextEvent loop,
  81. # and is started off in "signal(SIGINT, SIG_IGN)" mode by ksh,
  82. # it will fail to notice immediately if we ourselves are interrupted.
  83. # So we ask for the opportunity to end it.
  84.  
  85. case `trap` in
  86.     *2:*3:*|*3:*2:)    ;;
  87.     *2:*)    trap 'kill 0' 3 ;;
  88.     *3:*)    trap 'kill 0' 2 ;;
  89.     *)    trap 'kill 0' 2 3 ;;
  90. esac
  91.  
  92. dox -verbose $flags |&
  93.  
  94. case $sawid in
  95.     0)    print -p createsimplewindow root \
  96.             $OUTER_WINDOW_DEF_X \
  97.             $OUTER_WINDOW_DEF_Y \
  98.             $OUTER_WINDOW_DEF_WIDTH \
  99.             $OUTER_WINDOW_DEF_HEIGHT \
  100.             $OUTER_WINDOW_BORDER \
  101.             black white
  102.         read -p window
  103.         print -p createsimplewindow $window \
  104.             $INNER_WINDOW_X \
  105.             $INNER_WINDOW_Y \
  106.             $INNER_WINDOW_WIDTH \
  107.             $INNER_WINDOW_HEIGHT \
  108.             $INNER_WINDOW_BORDER \
  109.             black white
  110.         read -p subwindow
  111.         ;;
  112. esac
  113.  
  114. # resizeredirect deliberately omitted below
  115.  
  116. print -p selectinput $window \
  117. keypress+keyrelease+buttonpress+buttonrelease+enterwindow+leavewindow+\
  118. pointermotion+button1motion+button2motion+button3motion+button4motion+\
  119. button5motion+buttonmotion+keymapstate+exposure+visibilitychange+\
  120. structurenotify+substructurenotify+substructureredirect+focuschange+\
  121. propertychange+colormapchange+ownergrabbutton
  122.  
  123. case $sawid in
  124.     0)    print -p storename $window \""$O"\"
  125.         print -p seticonname $window \""$O"\"
  126.         print -p mapwindow $subwindow
  127.         print -p mapwindow $window
  128.         ;;
  129. esac
  130.  
  131. while :
  132. do
  133.     print -p nextevent
  134.     read -p
  135.     print "$REPLY"
  136. done
  137.